<?php
global $arrLogoTeamEuro2012;
?>

        <!-- InstanceBeginEditable name="col left" -->
        <div id="cate_club" class="box_width_common">
            <div class="box_content_common">
                <?php 
                if (!empty($this->arrTeam))
                {
                ?>
                <div id="container_content">
                    <ul id="tabs_top">
                        <li class="active_tab_top">
                            <a href="#" class="txt_gray">Vòng bảng</a>
                        </li>
                        <li>
                            <a href="#" class="txt_gray">Đấu loại trực tiếp</a>
                        </li>
                    </ul>
                    <?php 
                   // echo "<pre>"; print_r($this->arrTeam);exit;
                    foreach ($this->arrTeam as $key => $team)
                    {
                        $nameTable = explode('-', $key);                      
                    ?>
                    <div class="vongbang_dau">                        
                        <table>
                            <tr class="row_top_tbl">
                                <td class="w150"><p class="top_name_doibong"><span>Bảng</span><span class="name_bang"><?php echo ucfirst($nameTable[1]); ?></span></p></td>
                                <td><span>Điểm</span></td>
                                <td class="w140">
                                    <span class="w30">Trận</span>
                                    <span class="w30">Thắng</span>
                                    <span class="w30">Hòa</span>
                                    <span class="w30">Thua</span>
                                </td>
                                <td><span>H.Số</span></td>
                            </tr>
                            <?php 
                            if (!empty ($team['Team']))
                            {
                                $i = 0;
                                foreach($team['Team'] as $value)
                                {
                                    $i++;
                            ?>
                                    <tr class="bg_row_le">
                                        <td class="name_doibong">
                                            <span><?php echo $i; ?></span>
                                            <span>
                                                <img src="<?php echo $this->config['euro2012']['images'].$arrLogoTeamEuro2012[$value['team_id']];?>" alt="<?php echo $value['name'];?>" title="<?php echo $value['name'];?>" />
                                            </span>
                                            <span><?php echo $value['name']; ?></span>
                                        </td>
                                        <td><b><?php echo $value['point']; ?></b></td>
                                        <td>
                                            <span class="w30"><?php echo $value['won'] + $value['draw'] + $value['lost']; ?></span>
                                            <span class="w30"><?php echo $value['won']; ?></span>
                                            <span class="w30"><?php echo $value['drawn']; ?></span>
                                            <span class="w30"><?php echo $value['lost']; ?></span>
                                        </td>
                                        <td><span><?php echo $value['won'] - $value['draw'] - $value['lost']; ?>/<?php echo $value['won'] + $value['draw'] + $value['lost']; ?></span></td>
                                    </tr>
                            <?php 
                                }
                            }
                            ?>
                        </table>
                        <div class="btn_btn_anlichthidau_left">
                            <a href="javascript:;" class="btn_anlichthidau" rel="bảng <?php echo ucfirst($nameTable[1]); ?>">
                                <span>Ẩn lịch thi đấu Bảng <?php echo ucfirst($nameTable[1]); ?></span>
                            </a>
                        </div>
                        <div class="clear"></div>
                        <ul class="list_capdau box_width_common">
                           <?php 
                            if (!empty ($team['Matches']))
                            {
                                $i = 0;
                                foreach($team['Matches'] as $value)
                                {
                                    $i++;
                                    $name1=$value['TeamName1'];
                                    $name2=$value['TeamName2'];
                                   // echo "<pre>";print_r($value);
                            ?>
                            <li>
                                <div class="txt_trandau">
                                    <div class="box_width_common">
                                        <div class="left"><?php
                                            $dayOfWeek = date('N', $match['DatetimeHappen']) + 1;
                                            if ($dayOfWeek == 8)
                                                echo 'Chủ nhật';
                                            else
                                                echo "Thứ $dayOfWeek";
                                            echo ', ', date('d/m/Y', $match['DatetimeHappen']);
                                            ?></div>

                                    </div>
                                    <div class="clear">&nbsp;</div>
                                </div>
                                <div class="time w80 left txt_gray txt_right"><?php echo date('H:i', $match['DatetimeHappen']);?></div>
                                <div class="capdau">
                                    <div class="w230 left"> <img class="right" alt="" src="<?php echo $this->config['euro2012']['images'].$arrLogoTeamEuro2012[$value['Team1']];?>" width="38" height="24"><span class="right"><a class="txt_black_hover_blue" href="#"><?php echo $name1;?></a></span></div>
                                    <div class="w50 left txt_center txt_gray"> v </div>
                                    <div class="w230 left"> <img class="left" alt="" src="<?php echo $this->config['euro2012']['images'].$arrLogoTeamEuro2012[$value['Team2']];?>" width="38" height="24"><span class="left"><a class="txt_black_hover_blue" href="#"><?php echo $name2;?></a></span></div>
                                </div>
                                <div class="box_width_common txt_link_thongtin_capdau">
                                    <p> <a class="txt_gray" href="#">Thông tin trước trận đấu</a> &nbsp; | &nbsp; <a class="txt_gray" href="#">Trực tiếp</a> &nbsp; | &nbsp; <a class="txt_gray" href="#">Đánh giá cầu thủ</a> &nbsp; | &nbsp; <a class="txt_gray" href="#">Video</a> </p>
                                </div>
                            </li>
                           <?php 
                                }
                            }
                            ?>
                        </ul>
                    </div>
                    <?php 
                    }
                    ?>
                </div>
                <?php 
                }
                ?>
            </div>
        </div>

        <!-- InstanceEndEditable -->                 
    
   
<script language="javascript" type="text/javascript" src="<?php echo $this->config['euro2012']['js']; ?>/lib/jquery.min.js.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $this->config['euro2012']['js']; ?>/common.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $this->config['euro2012']['js']; ?>/slides.min.jquery.js"></script>
<!-- InstanceBeginEditable name="Javascript" -->
<script language="javascript" type="text/javascript">
    $(function(){
        $('#cate_club a.btn_anlichthidau').click(
        function(){
            var contentCapdau = $(this).parent().parent().find('.list_capdau');
            var bangdau = $(this).attr('rel');
            console.log(bangdau);
            if(contentCapdau.css('display') == 'block'){
                $('#cate_club .list_capdau').slideUp();
                $('#cate_club a.btn_anlichthidau span').removeClass('active').text('Xem lịch thi đấu ' + bangdau);
            }
            if(contentCapdau.css('display') == 'none'){
                $('#cate_club a.btn_anlichthidau span').removeClass('active').text('Xem lịch thi đấu ' + bangdau);
                $('#cate_club .list_capdau').slideUp();
                contentCapdau.slideDown();
                $(this).find('span').addClass('active').text('Ẩn lịch thi đấu ' + bangdau);

            }
        }

    )
    });
</script>